#include <iostream>
#include <vector>
#include <string>

using namespace std;

string describe(string last){
    string ret; int num = last[0] - '0', times = 1;
    for(int i = 1; i < last.size(); i++){
        if(num == last[i] - '0'){
            times++;
        }else{
            ret += to_string(times) + to_string(num);
            num = last[i] - '0'; times = 1;
        }
    }
    return ret + to_string(times) + to_string(num);
}

string countAndSay(int n) {
    string last = "1";
    for(int i = 1; i < n; i++){
        last = describe(last);
    }
    return last;
}

int main(){
    int n = 5;
    cout << countAndSay(n) << endl;
    return 0;
}
